package com.tidc.usermanager.mapper;

import com.tidc.api.pojo.user.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @ClassNmae UserMapper
 * @Description TODO
 * @Author 冯涛滔
 **/
@Repository
public interface UserMapper {
	@Insert("insert into user(name,email,password,status) values(#{name},#{email},#{password},#{status})")
	@Options(useGeneratedKeys = true,keyProperty = "id")
	int Register(User user);


	@Select("SELECT id,name,email FROM user WHERE id = #{id} AND status = 3")
	User getSchool(int id);
	@Select("SELECT * FROM user WHERE email = #{email}")
	User checkRepetition(String email);
	@Select("SELECT user.* FROM user LEFT JOIN user_detail ud ON user.id = ud.detail_user_id WHERE ud.school_id = #{school} AND status = 1")
	List<User> listSchoolStudent(int schoolId);


	User getSchoolCode(String code);
	List<String> listStudentEmail(List<Integer> list);
	User getUserInfo(String email);
}
